using System;
using System.Collections.Generic;
using System.Text;

namespace BlackJackSimulator
    {
    [Serializable]
    public class Player
        {
        private int m_PlayerID;
        private List<Hand> m_PlayerHand = new List<Hand>();
        private bool m_DidPlayerWin;
        private int m_NumberOfWins;
        private int m_NumberofTimesPlayerPlayed;
        private bool m_PlayerIsDealer;
        private double m_TotalWinnings;
        private double m_TotalBets;
        private int m_CountOfBlackjacks;
        private PlayerMatrix m_PlayerMatrix = new PlayerMatrix();

        public Player()
            {
           

            }

        private string m_PlayerMatrixID="";

        public string PlayerMatrixID
            {
            get { return m_PlayerMatrixID; }
            set { m_PlayerMatrixID = value; }
            }

        public Player(int ID)
            {
            m_PlayerID = ID;

            }
        public void LoadPlayerMatrix(string FilenameOfMatrix)
            {
            m_PlayerMatrix.dtPlayerMatrix_2.Clear();

            m_PlayerMatrix.dtPlayerMatrix_2.Constraints.Clear();

            m_PlayerMatrix.dtPlayerMatrix_2.ReadXml(FilenameOfMatrix);
            m_PlayerMatrixID = FilenameOfMatrix;
            
            }
        public PlayerMatrix CurrentPlayerMatrix
            {
            get { return m_PlayerMatrix; }
            set { m_PlayerMatrix = value; }
            }
        public int CountOfBlackjacks
            {
            get { return m_CountOfBlackjacks; }
            set { m_CountOfBlackjacks = value; }
            }
        public bool DidPlayerWin
            {
            get
            { return m_DidPlayerWin; }
            set { m_DidPlayerWin = value; }
            }
        public bool Reset()
            {
            this.DidPlayerWin = false;
            PlayerHand.Clear();
            return true;
            }
        public double TotalBets
            {
            get { return m_TotalBets; }
            set { m_TotalBets = value; }
            }
        public double TotalWinnings
            {
            get { return m_TotalWinnings; }
            set { m_TotalWinnings = value; }
            }
        public Hand AddHandToPlayer()
            {
            Hand newHd = new Hand();
            newHd.Hand_ID = m_PlayerHand.Count + 1;
            m_PlayerHand.Add(newHd);
            return newHd;

            }
        public bool IsPlayerDealer
            {
            get { return m_PlayerIsDealer; }
            set { m_PlayerIsDealer = true; }
            }

        public int PlayerID
            {
            get
                {
                return m_PlayerID;
                }
            set
                {
                m_PlayerID = value;
                if (m_PlayerID == 1) { m_PlayerIsDealer = true; }
                }
            }
        public int IncrementPlayerWins()
            {
            m_NumberOfWins += 1;
            return m_NumberOfWins;
            }
        public int IncrementNumberOfHandsPlayerPlayed()
            {
            m_NumberofTimesPlayerPlayed += 1;
            return m_NumberofTimesPlayerPlayed;
            }
        public int NumberOfWins
            {
            get { return m_NumberOfWins; }
            set { m_NumberOfWins = value; }
            }
        public int NumberofTimesPlayerPlayed
            {
            get { return m_NumberofTimesPlayerPlayed; }
            set { m_NumberofTimesPlayerPlayed = value; }
            }
        public List<Hand> PlayerHand
            {
            get { return m_PlayerHand; }
            }
        }
    }
